﻿@{
    ViewData["Title"] = "Edit";
    Layout = null;
}

<!doctype html>
<html lang="en">


<link href="~/Content/bootstrap.css" rel="stylesheet" />
<script src="~/Scripts/jquery-3.4.1.min.js"></script>
<script src="~/layui/layui.js"></script>
<link href="~/layer/skin/layer.css" rel="stylesheet" />

<table style="text-align:center" align="center">
          <tr>
              <td>状态</td>
            <td style="width: 400px;">
                <div class="layui-form-item">
                    <div>
                        <input type="radio" name="Sex" value="2" title="通过" checked>通过
                        <input type="radio" name="Sex" value="3" title="拒绝"> 拒绝
                    </div>
                </div>
            </td>
        </tr>
        <tr>
            <td>意见</td>
            <td>
                <textarea id="Dcause" name="Dcause" placeholder="请输入备注" class="layui-textarea" >无</textarea>
            </td>
        </tr>
        <tr>
            <td>
                <input type="button"  value="修改"  onclick="PostAddPower()"/>
           </td>

            <td>
                <input type="button" value="返回" onclick="location.href='/examination/Index'"/>
            </td>
        </tr>
</table>

<script>
    function PostAddPower() {

       var id=@ViewBag.Id;
       var Tid=@ViewBag.Tid;
       var Nid=@ViewBag.NId;
       var Did=@ViewBag.DId;
       var AuditStatus=$("[name=Sex]:checked").val();
       var  AuditProposal=$("#Dcause").val();
       if(Nid==3)
       {
           $.ajax({
               url:"/examination/Updates",
               type:"put",
               data:{id:id,TId:Tid,Did:Did,AuditStatus:AuditStatus,AuditProposal:AuditProposal},
               success:function(obj)
               {
                if (obj > 0) {
                      alert("修改成功!!!");
                      location.href="/examination/Index";
                    return;
                } 
                     alert("修改失败!!!");
                    return;
               
               }
           })
       }
        if(Nid==1||Nid==2)
       {
           $.ajax({
               url:"/examination/UpdateB",
               type:"put",
               data:{id:id,AuditStatus:AuditStatus,AuditProposal:AuditProposal},
               success:function(obj)
               {
                if (obj > 0) {
                    alert("修改成功!!!");
                    location.href="/examination/Index";
                    return;
                } 
                   alert("修改失败!!!");
                    return;
               
               }
           })
       }
    } 
</script>
</html>
